package cn.tedu.es.demo.practice;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.time.LocalDate;

@Data
@AllArgsConstructor
@NoArgsConstructor
//使用student作为文档实体
@Document(indexName = "student")
@Setting(shards = 1,replicas = 0)
public class Student {
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String name;
    @Id//当前文档属性 会被用作 文档id
    @Field(type = FieldType.Keyword)
    private String studentNo;
    @Field(type = FieldType.Date,format = {DateFormat.date})
    private LocalDate birthday;
    @GeoPointField
    private String location;
    @Field(type = FieldType.Keyword)
    private String gender;
}

